/**
 * 2
 *  
 * @Author : roryrywang
 * @DateTime : 24-8-24 上午9:51
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    long long a, b, c, aa, bb, cc, k;
    cin >> aa >> bb >> cc >> k;
    long long sum = aa + bb + cc;
    a = min(aa, min(bb, cc));
    c = max(aa, max(bb, cc));
    b = sum - a - c;

    double avg = (double) (sum + k) / 3.0;

    if (c <= avg) {
        a = (sum + k) / 3;
        b = (sum + k - a) / 2;
        c = (sum + k - a - b);
    } else {
        avg = (double) (sum + k - c) / 2.0;
        if ((double) b >= avg) {
            a += k;
        } else {
            a = (sum + k - c) / 2;
            b = (sum + k - a - c) / 2;
        }
    }

    long long result = ((((a % MOD) * (b % MOD)) % MOD) * (c % MOD)) % MOD;

    cout << result;

    return 0;
}